package hjw.com.service;

import hjw.com.dao.OrderItemMapper;
import hjw.com.entity.OrderItem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>Project:Academic - OrderItemServiceImpl
 *
 * @author IvanWei玮 -- maste
 * @version 1.0
 * @DataTime 2025/2/18 13:50
 * @since 1.8
 */
@Service
public class OrderItemServiceImpl implements OrderItemService{
    private final OrderItemMapper orderItemDao;

    @Autowired
    public OrderItemServiceImpl(OrderItemMapper orderItemDao) {
        this.orderItemDao = orderItemDao;
    }

    @Override
    public List<OrderItem> findByOrderId(int orderId) {
        return orderItemDao.findByOrderId(orderId);
    }

    @Override
    public OrderItem findByItemId(int itemId) {
        return orderItemDao.findByItemId(itemId);
    }

    @Override
    public int addOrderItem(OrderItem orderItem) {
        return orderItemDao.addOrderItem(orderItem);
    }

    @Override
    public int deleteOrderItem(OrderItem orderItem) {
        return orderItemDao.deleteOrderItem(orderItem);
    }
}
